package com.itcoon.cloud.framework.webmvc.config.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.ArrayList;
import java.util.List;

/**
 * 异常告警配置参数
 */
@ConfigurationProperties(prefix = "itcoon.exception")
public class GlobalExceptionAlarmConfigProperties {

    private Alarm alarm = new Alarm();

    public Alarm getAlarm() {
        return alarm;
    }

    public void setAlarm(Alarm alarm) {
        this.alarm = alarm;
    }

    public static class Alarm{

        /**
         *  是否启用
         */
        private Boolean enable = false;

        /**
         * 促发告警异常编码
         */
        private List<String> alarmCodes = new ArrayList<>();

        private Integer[] includeCodeRange = new Integer[]{0, 999999};

        private Integer[] excludeCodeRange = new Integer[0];

        /**
         * 接收人
         */
        private String[] receivers;

        /**
         * 告警邮件模版路径
         */
        private String templateSourcePath;

        /**
         *
         */
        private Long minRate = 1800000L;

        public Boolean getEnable() {
            return enable;
        }

        public void setEnable(Boolean enable) {
            this.enable = enable;
        }

        public List<String> getAlarmCodes() {
            return alarmCodes;
        }

        public void setAlarmCodes(List<String> alarmCodes) {
            this.alarmCodes = alarmCodes;
        }

        public Integer[] getIncludeCodeRange() {
            return includeCodeRange;
        }

        public void setIncludeCodeRange(Integer[] includeCodeRange) {
            this.includeCodeRange = includeCodeRange;
        }

        public Integer[] getExcludeCodeRange() {
            return excludeCodeRange;
        }

        public void setExcludeCodeRange(Integer[] excludeCodeRange) {
            this.excludeCodeRange = excludeCodeRange;
        }

        public String[] getReceivers() {
            return receivers;
        }

        public void setReceivers(String[] receivers) {
            this.receivers = receivers;
        }

        public String getTemplateSourcePath() {
            return templateSourcePath;
        }

        public void setTemplateSourcePath(String templateSourcePath) {
            this.templateSourcePath = templateSourcePath;
        }

        public Long getMinRate() {
            return minRate;
        }

        public void setMinRate(Long minRate) {
            this.minRate = minRate;
        }
    }
}
